package com.designpattern.observer.user;

import java.util.ArrayList;
import java.util.List;

public class SubDescription implements Subject {

    List<Observer> list = new ArrayList<>();
    @Override
    public void attch(Observer observer) {
       list.add(observer);

    }

    @Override
    public void detach(Observer observer) {
        list.remove(observer);
    }

    @Override
    public void notify(String message) {

        for (Observer observer : list) {
            observer.update(message);
        }
    }
}
